<template>
  <router-view />
</template>

<script lang="ts">
import { provide,ref } from 'vue'
import { router } from './router';

export default {
  name: 'App',
  setup() {
    const clientWidth = document.documentElement.clientWidth
    console.log(clientWidth, 'clientWidth');
    const isMobile = clientWidth <= 500
    const asideVisible = ref(isMobile ? false: true)
    provide('asideVisible',asideVisible)

    router.afterEach(() => {
      // 手机端每次切换路由后关闭侧边栏,
      if (isMobile) {
        console.log('关闭侧边栏');
        
        asideVisible.value = false
      }
    })
  }
}
</script>
